﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CPPEI.WorkflowCore.Simulator
{
    public class ActionRecordStorage : IActionRecordStorage
    {
        List<ActionRecord> _list = new List<ActionRecord>();

        public PagedList<ActionRecord> FindList(Guid instanceId, int start, int limit)
        {
            List<ActionRecord> list = _list.Where(p => p.InstanceId == instanceId).Take(limit).Skip(start).ToList();
            return new PagedList<ActionRecord>(_list.Where(p => p.Id == instanceId).Count(), start, limit, list);
        }

        public void Save(ActionRecord record)
        {
            _list.Add(record);
        }

        public void Remove(ActionRecord record)
        {
            _list.Remove(record);
        }
    }
}
